import Vue from 'vue'
import Router from 'vue-router'

const Peronal = resolve => {
  import('@/view/personal').then(module => {
    resolve(module)
  })
}

const PeronalHome = resolve => {
  import('@/view/personal/home').then(module => {
    resolve(module)
  })
}
const PeronalReview = resolve => {
  import('@/view/personal/review').then(module => {
    resolve(module)
  })
}
const PeronalActivity = resolve => {
  import('@/view/personal/activity').then(module => {
    resolve(module)
  })
}
const PeronalCamp = resolve => {
  import('@/view/personal/camp').then(module => {
    resolve(module)
  })
}
const PeronalMy = resolve => {
  import('@/view/personal/my').then(module => {
    resolve(module)
  })
}

const Organization = resolve => {
  import('@/view/organization').then(module => {
    resolve(module)
  })
}

const OrganizationProduct = resolve => {
  import('@/view/organization/product').then(module => {
    resolve(module)
  })
}
const OrganizationResources = resolve => {
  import('@/view/organization/resources').then(module => {
    resolve(module)
  })
}
const OrganizationCommunication = resolve => {
  import('@/view/organization/communication').then(module => {
    resolve(module)
  })
}
const OrganizationMy = resolve => {
  import('@/view/organization/my').then(module => {
    resolve(module)
  })
}

const ActiveDetail = resolve => {
  import('@/view/other/active-detail').then(module => {
    resolve(module)
  })
}
const ActiveSignup = resolve => {
  import('@/view/other/active-signup').then(module => {
    resolve(module)
  })
}

const ArticleDetail = resolve => {
  import('@/view/other/article-detail').then(module => {
    resolve(module)
  })
}

const ActiveMember = resolve => {
  import('@/view/other/active-member').then(module => {
    resolve(module)
  })
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/personal'
    }, {
      path: '/personal',
      component: Peronal,
      redirect: '/personal/home',
      children: [
        {
          path: '/personal/home',
          component: PeronalHome
        }, {
          path: '/personal/camp',
          component: PeronalCamp
        }, {
          path: '/personal/camp/detail:id',
          name: 'camp',
          component: ArticleDetail
        }, {
          path: '/personal/my',
          component: PeronalMy
        }, {
          path: '/personal/activity',
          component: PeronalActivity
        }, {
          path: '/personal/activity/detail:id',
          name: 'activity',
          component: ActiveDetail
        }, {
          path: '/personal/activity/signup/:id/:classid',
          name: 'ActiveSignup',
          component: ActiveSignup
        }, {
          path: '/personal/activity/member/:id',
          component: ActiveMember
        }, {
          path: '/personal/review',
          component: PeronalReview
        }, {
          path: '/personal/review/detail:id',
          name: 'review',
          component: ActiveDetail
        }
      ]
    }, {
      path: '/organization',
      component: Organization,
      redirect: '/organization/product',
      children: [
        {
          path: '/organization/product',
          component: OrganizationProduct
        }, {
          path: '/organization/resources',
          component: OrganizationResources
        }, {
          path: '/organization/communication',
          component: OrganizationCommunication
        }, {
          path: '/organization/my',
          component: OrganizationMy
        }
      ]
    }, {
      path: '/activeDetail',
      component: ActiveDetail
    }

  ]
})
